import request from '@/utils/request.js'

// 获取推荐课程
export function getRecommendCourses() {
  return request({
	///user/api/courses/recommend
		
    url: '/api/courses/recommend',
    method: 'GET'
  })
}

// 获取课程详情 todo
export function getCourseDetail(id) {
  return request({
    url: `/api/courses/${id}`,
    method: 'GET'
  })
}

// 获取课程列表
export function getCourseList(params) {
  return request({
    url: '/api/courses',
    method: 'GET',
    params
  })
}


/*
const res = await request({
          url: '/user/api/courses/teacher',
          method: 'GET',
          params: { teacherId: this.teacherId }
        });
*/
export function getTeacherCourse(teacherId){
	return request({
		url: 'api/courses/teacher',
		method: 'GET',
		params: { teacherId: teacherId }
	})
}

// 导出courseApi对象
export const courseApi = {
  getRecommendCourses,
  getCourseDetail,
  getCourseList,
  getTeacherCourse
} 